Removed the private sharing of internal treeview macros from gtktreeprivate.h
authorTristan Van Berkom <tristan.van.berkom@gmail.com>
Tue, 30 Nov 2010 06:28:14 +0000 (15:28 +0900)
committerTristan Van Berkom <tristan.van.berkom@gmail.com>
Sun, 5 Dec 2010 13:11:21 +0000 (22:11 +0900)
Added them directly to gtktreeview.c.

gtk/gtkfilechooserdefault.c
gtk/gtktreeprivate.h
gtk/gtktreeview.c

index 1ae575880e9d92e9e9d9e0c77dd6162c49f0232f..a3de75b65d4d753302b5a9aaeaae85fb3f9647f5 100644 (file)
@@ -2998,14 +2998,18 @@ shortcuts_compute_drop_position (GtkFileChooserDefault   *impl,
   GdkRectangle cell;
   int row;
   int bookmarks_index;
+  int header_height = 0;
 
   tree_view = GTK_TREE_VIEW (impl->browse_shortcuts_tree_view);
 
+  if (gtk_tree_view_get_headers_visible (tree_view))
+    header_height = _gtk_tree_view_get_header_height (tree_view);
+
   bookmarks_index = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS);
 
   if (!gtk_tree_view_get_path_at_pos (tree_view,
                                       x,
-                                     y - TREE_VIEW_HEADER_HEIGHT (tree_view),
+                                     y - header_height,
                                       path,
                                       &column,
                                       NULL,
index 1a5f9b353c85fd034a7d975855f33d067dda2635..d018bdca9fef8181f9c16a3cab86504d9173d567 100644 (file)
@@ -30,18 +30,6 @@ G_BEGIN_DECLS
 
 #define TREE_VIEW_DRAG_WIDTH 6
 
-typedef enum
-{
-  GTK_TREE_VIEW_IS_LIST = 1 << 0,
-  GTK_TREE_VIEW_SHOW_EXPANDERS = 1 << 1,
-  GTK_TREE_VIEW_IN_COLUMN_RESIZE = 1 << 2,
-  GTK_TREE_VIEW_ARROW_PRELIT = 1 << 3,
-  GTK_TREE_VIEW_HEADERS_VISIBLE = 1 << 4,
-  GTK_TREE_VIEW_DRAW_KEYFOCUS = 1 << 5,
-  GTK_TREE_VIEW_MODEL_SETUP = 1 << 6,
-  GTK_TREE_VIEW_IN_COLUMN_DRAG = 1 << 7
-} GtkTreeViewFlags;
-
 typedef enum
 {
   GTK_TREE_SELECT_MODE_TOGGLE = 1 << 0,
@@ -49,34 +37,6 @@ typedef enum
 }
 GtkTreeSelectMode;
 
-enum
-{
-  DRAG_COLUMN_WINDOW_STATE_UNSET = 0,
-  DRAG_COLUMN_WINDOW_STATE_ORIGINAL = 1,
-  DRAG_COLUMN_WINDOW_STATE_ARROW = 2,
-  DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT = 3,
-  DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT = 4
-};
-
-enum
-{
-  RUBBER_BAND_OFF = 0,
-  RUBBER_BAND_MAYBE_START = 1,
-  RUBBER_BAND_ACTIVE = 2
-};
-
-#define GTK_TREE_VIEW_SET_FLAG(tree_view, flag)   G_STMT_START{ (tree_view->priv->flags|=flag); }G_STMT_END
-#define GTK_TREE_VIEW_UNSET_FLAG(tree_view, flag) G_STMT_START{ (tree_view->priv->flags&=~(flag)); }G_STMT_END
-#define GTK_TREE_VIEW_FLAG_SET(tree_view, flag)   ((tree_view->priv->flags&flag)==flag)
-#define TREE_VIEW_HEADER_HEIGHT(tree_view)        (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE)?tree_view->priv->header_height:0)
-#define TREE_VIEW_COLUMN_REQUESTED_WIDTH(column)  (CLAMP (column->requested_width, (column->min_width!=-1)?column->min_width:column->requested_width, (column->max_width!=-1)?column->max_width:column->requested_width))
-#define TREE_VIEW_DRAW_EXPANDERS(tree_view)       (!GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IS_LIST)&&GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS))
-
- /* This lovely little value is used to determine how far away from the title bar
-  * you can move the mouse and still have a column drag work.
-  */
-#define TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER(tree_view) (10*TREE_VIEW_HEADER_HEIGHT(tree_view))
-
 typedef struct _GtkTreeViewColumnReorder GtkTreeViewColumnReorder;
 struct _GtkTreeViewColumnReorder
 {
@@ -309,76 +269,6 @@ struct _GtkTreeViewPrivate
   guint vscroll_policy : 1;
 };
 
-#ifdef __GNUC__
-
-#define TREE_VIEW_INTERNAL_ASSERT(expr, ret)     G_STMT_START{          \
-     if (!(expr))                                                       \
-       {                                                                \
-         g_log (G_LOG_DOMAIN,                                           \
-                G_LOG_LEVEL_CRITICAL,                                   \
-               "%s (%s): assertion `%s' failed.\n"                     \
-               "There is a disparity between the internal view of the GtkTreeView,\n"    \
-               "and the GtkTreeModel.  This generally means that the model has changed\n"\
-               "without letting the view know.  Any display from now on is likely to\n"  \
-               "be incorrect.\n",                                                        \
-                G_STRLOC,                                               \
-                G_STRFUNC,                                              \
-                #expr);                                                 \
-         return ret;                                                    \
-       };                               }G_STMT_END
-
-#define TREE_VIEW_INTERNAL_ASSERT_VOID(expr)     G_STMT_START{          \
-     if (!(expr))                                                       \
-       {                                                                \
-         g_log (G_LOG_DOMAIN,                                           \
-                G_LOG_LEVEL_CRITICAL,                                   \
-               "%s (%s): assertion `%s' failed.\n"                     \
-               "There is a disparity between the internal view of the GtkTreeView,\n"    \
-               "and the GtkTreeModel.  This generally means that the model has changed\n"\
-               "without letting the view know.  Any display from now on is likely to\n"  \
-               "be incorrect.\n",                                                        \
-                G_STRLOC,                                               \
-                G_STRFUNC,                                              \
-                #expr);                                                 \
-         return;                                                        \
-       };                               }G_STMT_END
-
-#else
-
-#define TREE_VIEW_INTERNAL_ASSERT(expr, ret)     G_STMT_START{          \
-     if (!(expr))                                                       \
-       {                                                                \
-         g_log (G_LOG_DOMAIN,                                           \
-                G_LOG_LEVEL_CRITICAL,                                   \
-               "file %s: line %d: assertion `%s' failed.\n"       \
-               "There is a disparity between the internal view of the GtkTreeView,\n"    \
-               "and the GtkTreeModel.  This generally means that the model has changed\n"\
-               "without letting the view know.  Any display from now on is likely to\n"  \
-               "be incorrect.\n",                                                        \
-                __FILE__,                                               \
-                __LINE__,                                               \
-                #expr);                                                 \
-         return ret;                                                    \
-       };                               }G_STMT_END
-
-#define TREE_VIEW_INTERNAL_ASSERT_VOID(expr)     G_STMT_START{          \
-     if (!(expr))                                                       \
-       {                                                                \
-         g_log (G_LOG_DOMAIN,                                           \
-                G_LOG_LEVEL_CRITICAL,                                   \
-               "file %s: line %d: assertion '%s' failed.\n"            \
-               "There is a disparity between the internal view of the GtkTreeView,\n"    \
-               "and the GtkTreeModel.  This generally means that the model has changed\n"\
-               "without letting the view know.  Any display from now on is likely to\n"  \
-               "be incorrect.\n",                                                        \
-                __FILE__,                                               \
-                __LINE__,                                               \
-                #expr);                                                 \
-         return;                                                        \
-       };                               }G_STMT_END
-#endif
-
-
 /* functions that shouldn't be exported */
 void         _gtk_tree_selection_internal_select_node (GtkTreeSelection  *selection,
                                                       GtkRBNode         *node,
@@ -415,9 +305,9 @@ void         _gtk_tree_view_remove_editable           (GtkTreeView       *tree_v
                                                        GtkCellEditable   *cell_editable);
 
 void       _gtk_tree_view_install_mark_rows_col_dirty (GtkTreeView *tree_view);
-void             _gtk_tree_view_column_autosize          (GtkTreeView       *tree_view,
-                                                         GtkTreeViewColumn *column);
-
+void         _gtk_tree_view_column_autosize           (GtkTreeView       *tree_view,
+                                                      GtkTreeViewColumn *column);
+gint         _gtk_tree_view_get_header_height         (GtkTreeView       *tree_view);
 
 GtkTreeSelection* _gtk_tree_selection_new                (void);
 GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView      *tree_view);
index a8b1790060b4d2d6676d2aa9d1bcdf7398811835..22b7a5b611c3550c81bccb77f2dfb2d2be31da42 100644 (file)
  */
 
 
+typedef enum
+{
+  GTK_TREE_VIEW_IS_LIST = 1 << 0,
+  GTK_TREE_VIEW_SHOW_EXPANDERS = 1 << 1,
+  GTK_TREE_VIEW_IN_COLUMN_RESIZE = 1 << 2,
+  GTK_TREE_VIEW_ARROW_PRELIT = 1 << 3,
+  GTK_TREE_VIEW_HEADERS_VISIBLE = 1 << 4,
+  GTK_TREE_VIEW_DRAW_KEYFOCUS = 1 << 5,
+  GTK_TREE_VIEW_MODEL_SETUP = 1 << 6,
+  GTK_TREE_VIEW_IN_COLUMN_DRAG = 1 << 7
+} GtkTreeViewFlags;
+
+enum
+{
+  DRAG_COLUMN_WINDOW_STATE_UNSET = 0,
+  DRAG_COLUMN_WINDOW_STATE_ORIGINAL = 1,
+  DRAG_COLUMN_WINDOW_STATE_ARROW = 2,
+  DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT = 3,
+  DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT = 4
+};
+
+enum
+{
+  RUBBER_BAND_OFF = 0,
+  RUBBER_BAND_MAYBE_START = 1,
+  RUBBER_BAND_ACTIVE = 2
+};
+
+#define GTK_TREE_VIEW_SET_FLAG(tree_view, flag)   G_STMT_START{ (tree_view->priv->flags|=flag); }G_STMT_END
+#define GTK_TREE_VIEW_UNSET_FLAG(tree_view, flag) G_STMT_START{ (tree_view->priv->flags&=~(flag)); }G_STMT_END
+#define GTK_TREE_VIEW_FLAG_SET(tree_view, flag)   ((tree_view->priv->flags&flag)==flag)
+#define TREE_VIEW_HEADER_HEIGHT(tree_view)        (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE)?tree_view->priv->header_height:0)
+#define TREE_VIEW_COLUMN_REQUESTED_WIDTH(column)  (CLAMP (column->requested_width, (column->min_width!=-1)?column->min_width:column->requested_width, (column->max_width!=-1)?column->max_width:column->requested_width))
+#define TREE_VIEW_DRAW_EXPANDERS(tree_view)       (!GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IS_LIST)&&GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS))
+
+ /* This lovely little value is used to determine how far away from the title bar
+  * you can move the mouse and still have a column drag work.
+  */
+#define TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER(tree_view) (10*TREE_VIEW_HEADER_HEIGHT(tree_view))
+
+#ifdef __GNUC__
+
+#define TREE_VIEW_INTERNAL_ASSERT(expr, ret)     G_STMT_START{          \
+     if (!(expr))                                                       \
+       {                                                                \
+         g_log (G_LOG_DOMAIN,                                           \
+                G_LOG_LEVEL_CRITICAL,                                   \
+               "%s (%s): assertion `%s' failed.\n"                     \
+               "There is a disparity between the internal view of the GtkTreeView,\n"    \
+               "and the GtkTreeModel.  This generally means that the model has changed\n"\
+               "without letting the view know.  Any display from now on is likely to\n"  \
+               "be incorrect.\n",                                                        \
+                G_STRLOC,                                               \
+                G_STRFUNC,                                              \
+                #expr);                                                 \
+         return ret;                                                    \
+       };                               }G_STMT_END
+
+#define TREE_VIEW_INTERNAL_ASSERT_VOID(expr)     G_STMT_START{          \
+     if (!(expr))                                                       \
+       {                                                                \
+         g_log (G_LOG_DOMAIN,                                           \
+                G_LOG_LEVEL_CRITICAL,                                   \
+               "%s (%s): assertion `%s' failed.\n"                     \
+               "There is a disparity between the internal view of the GtkTreeView,\n"    \
+               "and the GtkTreeModel.  This generally means that the model has changed\n"\
+               "without letting the view know.  Any display from now on is likely to\n"  \
+               "be incorrect.\n",                                                        \
+                G_STRLOC,                                               \
+                G_STRFUNC,                                              \
+                #expr);                                                 \
+         return;                                                        \
+       };                               }G_STMT_END
+
+#else
+
+#define TREE_VIEW_INTERNAL_ASSERT(expr, ret)     G_STMT_START{          \
+     if (!(expr))                                                       \
+       {                                                                \
+         g_log (G_LOG_DOMAIN,                                           \
+                G_LOG_LEVEL_CRITICAL,                                   \
+               "file %s: line %d: assertion `%s' failed.\n"       \
+               "There is a disparity between the internal view of the GtkTreeView,\n"    \
+               "and the GtkTreeModel.  This generally means that the model has changed\n"\
+               "without letting the view know.  Any display from now on is likely to\n"  \
+               "be incorrect.\n",                                                        \
+                __FILE__,                                               \
+                __LINE__,                                               \
+                #expr);                                                 \
+         return ret;                                                    \
+       };                               }G_STMT_END
+
+#define TREE_VIEW_INTERNAL_ASSERT_VOID(expr)     G_STMT_START{          \
+     if (!(expr))                                                       \
+       {                                                                \
+         g_log (G_LOG_DOMAIN,                                           \
+                G_LOG_LEVEL_CRITICAL,                                   \
+               "file %s: line %d: assertion '%s' failed.\n"            \
+               "There is a disparity between the internal view of the GtkTreeView,\n"    \
+               "and the GtkTreeModel.  This generally means that the model has changed\n"\
+               "without letting the view know.  Any display from now on is likely to\n"  \
+               "be incorrect.\n",                                                        \
+                __FILE__,                                               \
+                __LINE__,                                               \
+                #expr);                                                 \
+         return;                                                        \
+       };                               }G_STMT_END
+#endif
+
 #define GTK_TREE_VIEW_PRIORITY_VALIDATE (GDK_PRIORITY_REDRAW + 5)
 #define GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC (GTK_TREE_VIEW_PRIORITY_VALIDATE + 2)
 #define GTK_TREE_VIEW_TIME_MS_PER_IDLE 30
@@ -9614,6 +9723,13 @@ _gtk_tree_view_queue_draw_node (GtkTreeView        *tree_view,
     }
 }
 
+gint
+_gtk_tree_view_get_header_height (GtkTreeView *tree_view)
+{
+  return tree_view->priv->header_height;
+}
+
+
 static void
 gtk_tree_view_queue_draw_path (GtkTreeView        *tree_view,
                                GtkTreePath        *path,